<div class="panel panel-info">
    <div class="panel-heading">
        <h3 class="panel-title">分享专辑</h3>
    </div>
    <div class="well">
         <form class="form-inline" role="form">
            <div class="form-group">
                <label class="control-label" for="name">email</label>
                <input type="text" class="form-control" id="email" name="email" value="<?php echo $email?>" placeholder="请输入email">
            </div>
            <div class="form-group">
                <label class="control-label" for="name">描述</label>
                <input type="text" class="form-control" id="caption" name="caption" value="<?php echo $caption?>"
                       placeholder="请输入标题">
            </div>
            <div class="form-group">
                <label class="control-label" for="name">特色专辑</label>
                <select name="special" id="special"  class="form-control">
                    <option value="1" <?php if($special=="1"):?>selected<?php endif;?>>是</option>
                    <option value="0" <?php if($special!="1"):?>selected<?php endif;?>>否</option>
                </select>
            </div>
            <button type="submit" class="btn btn-info"> 查询</button>
        </form>
        <div class="pagination">
            <button type="button" class="btn btn-primary" id="add_item">
                添加
            </button>
            <button type="button" class="btn btn-primary" id="remove_items">
                删除
            </button>
        </div>
    </div>
    <div class="panel-body">
        <table class="table table-condensed table-striped">
            <thead>
            <tr>
                <th><input type="checkbox" class="rows_check" /> </th>
                <th>编号</th>
                <th>用户名</th>
                <th>Email</th>
                <th>描述</th>
                <th>是否启用</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
                <?php if(isset($albumList['rows'])):?>
                <?php foreach($albumList['rows'] as $key=>$list):?>
                <tr>
                    <td><input type="checkbox" class="row_check" data-id="<?php echo $list['id'] ?>" /></td>
                    <td><?php echo $key+1 ?></td>
                    <td><?php echo $list['user_name'] ?></td>
                    <td><?php echo $list['user_email'] ?></td>
                    <td><?php echo $list['caption'] ?></td>
                    <td><?php echo $list['isdisabled']=="1"?"否":"是" ?></td>
                    <td><?php echo $list['createdon'] ?></td>
                    <td>
                        <button type="button" class="btn btn-primary update_item"  data-id="<?php echo $list['id'] ?>">
                            修改
                        </button>
                        <button type="button" class="btn btn-primary remove_item"  data-id="<?php echo $list['id'] ?>">
                            删除
                        </button>
                        <?php if(!empty($list['special'])&&$list['special']=="1"):?>
                        <button type="button" class="btn btn-primary upload_image"  data-id="<?php echo $list['id'] ?>">
                            上传图片
                        </button>
                        <?php endif;?>
                    </td>
                </tr>
                <?php endforeach; ?>
            <?php endif;?>
            </tbody>
        </table>
        <?php if($pages>1):?>
            <div class="well well-sm" style="text-align: center"><?php echo HTML::getPageHtml($page,$pages,"/admin/post/album?eamil=".$eamil.' &caption='.$caption."&special=".$special)?></div>
        <?php endif;?>
    </div>
</div>
<div class="modal fade" id="list_modal" tabindex="-1" role="dialog" model="album"
    aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                   专辑信息
                </h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" role="form" id="list_form" name="list_form">
                    <div class="form-group">
                        <input type="hidden" class="form-control" id="model_id" name="model_id" />
                    </div>
                    <div class="form-group">
                        <label for="user_id" class="col-sm-2 control-label">用户</label>
                        <div class="col-sm-10">
                            <select name="userid" id="userid"  class="form-control">
                                <?php if(!empty($users)):?>
                                <?php foreach($users as $u=>$ulist):?>
                                <option value="<?php echo $ulist['id'];?>"><?php echo $ulist['username'];?></option>
                                <?php endforeach;?>
                                <?php endif;?>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="caption" class="col-sm-2 control-label">描述</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="caption" name="caption"
                                   placeholder="请输入描述">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="email" class="col-sm-2 control-label">特色</label>
                        <div class="col-sm-10">
                            <select name="special" id="special"  class="form-control">
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="email" class="col-sm-2 control-label">是否启用</label>
                        <div class="col-sm-10">
                            <select name="isdisabled" id="isdisabled"  class="form-control">
                                <option value="0">是</option>
                                <option value="1">否</option>
                            </select>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default"
                        data-dismiss="modal">关闭
                </button>
                <button type="button" id="saveForm" class="btn btn-primary">
                    保存
                </button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="upload_modal" tabindex="-1" role="dialog" model="album"
    aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    上传图片
                </h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" role="form" id="image_form" name="image_form">
                    <div class="form-group">
                        <input type="hidden" class="form-control" id="upload_id" name="upload_id" />
                        <input type="hidden" class="form-control" id="filename" name="name" value="image" />
                        <input type="hidden" class="form-control"  name="model" value="album" />
                    </div>
                    <div class="form-group">
                        <label for="image" class="col-sm-2 control-label">图片地址</label>
                        <div class="col-sm-10">
                            <input type="file" id="image" name="image" />
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default"
                        data-dismiss="modal">关闭
                </button>
                <button type="button" id="saveImage" class="btn btn-primary">
                    上传
                </button>
            </div>
        </div>
    </div>
</div>

